//
//  YKRootTool.m
//  youkan
//
//  Created by mac mini on 16/2/27.
//  Copyright © 2016年 Honsintech. All rights reserved.
//

#import "YKRootTool.h"
#import "YKTabBarController.h"
#import "YKNewFeatureController.h"
#define YKVersionKey @"version"
@implementation YKRootTool
+(void)chooseRootViewController:(UIWindow*)window{
    NSString *currentVersinon = [[NSBundle mainBundle]objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
    NSString *lastVersion= [[NSUserDefaults standardUserDefaults]objectForKey:YKVersionKey];
    if ([currentVersinon isEqualToString:lastVersion]) {
        YKTabBarController *tabBarVc=[[YKTabBarController alloc]init];
        tabBarVc.view.backgroundColor =[UIColor redColor];
        //            设置为根控制器
        window.rootViewController=tabBarVc;
    }else{
        YKNewFeatureController *newFeature = [[YKNewFeatureController alloc]init];
        window.rootViewController = newFeature;
        [[NSUserDefaults standardUserDefaults] setObject:currentVersinon forKey:YKVersionKey];
    }

}
@end
